<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: taohj
  Date: 2014/8/13
  Time: 18:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>

<style>
    input {
        width: 200px;
    }
</style>


<script>
    $(function () {

        $('form a[action="init_upload"]').on('click', function () {
            $("form input[name='storage']").val(131);
            $(this).closest("td").find("div[action='init']").hide();
            $(this).closest("td").find("div[action='fileUpload']").show();
            $(this).closest("td").find("div[action='init']").hide();
        });


        $('form div[action="fileUpload"] a[action="cancel"]').on('click', function () {

            $(this).closest("td").find("div[action='init']").show();
            $(this).closest("td").find("div[action='fileUpload']").hide();
            $(this).closest("td").find("div[action='url']").hide();
            $(this).closest("td").find("[action='fileUpload']").find('input[type=text]').val('');

        });


        $('form a[action="init_link"]').on('click', function () {
            $(this).closest("td").find("div[action='init']").hide();
            $(this).closest("td").find("div[action='fileUpload']").hide();
            $(this).closest("td").find("div[action='url']").show();
            $("form input[name='storage']").val(132);
        });


        $('form div[action="fileUpload"] a[action="cancel"]').on('click', function () {
            $(this).closest("td").find("div[action='init']").show();
            $(this).closest("td").find("div[action='fileUpload']").hide();
            $(this).closest("td").find("div[action='url']").hide();
            $(this).closest("td").find("[action='fileUpload']").find('input[type=text]').val('');
            $("form input[name='storage']").val('');
        });


        $('form div[action="url"] a[action="cancel"]').on('click', function () {
            $(this).closest("td").find("div[action='init']").show();
            $(this).closest("td").find("div[action='fileUpload']").hide();
            $(this).closest("td").find("div[action='url']").hide();
            $(this).closest("td").find("[action='fileUpload']").find('input[type=text]').val('');
            $("form input[name='storage']").val('');
        });


    });
</script>


<div>
    <form enctype="multipart/form-data" method="post">


        <input type="hidden" name="storage" >


        <table style="padding-left: 20px; width: 100%; margin-top: 20px">
            <tr>
                <td style="width: 60px">标题:</td>
                <td style="width: 300px;  "><input name="title" type="text" class="easyui-textbox"
                                                   data-options="required:true"/></td>
            </tr>

            <tr>
                <td style="width: 60px">数据:</td>
                <td style="border: 0px solid;">

                    <div style="" action="init">
                        <a href="javascript:void(0)" class="easyui-linkbutton" action="init_upload"
                           style="width: 60px; ">上传</a>
                        <a href="javascript:void(0)" class="easyui-linkbutton" action="init_link" style="width: 60px;">链接</a>
                    </div>


                    <div style="display: none" action='fileUpload'>
                        <input type="text" name="file" style="width: 200px" class="easyui-filebox">
                        <a href="javascript:void(0)" action="cancel" class="easyui-linkbutton">取消</a>
                    </div>


                    <div style="display: none" action='url'>
                        <input type="text" name="file" style="width: 200px" class="easyui-textbox">
                        <a href="javascript:void(0)" action="cancel" class="easyui-linkbutton">取消</a>
                    </div>
                </td>
            </tr>


            <tr>
                <td>标签:</td>
                <td>
                    <input name="tags" type="text" class="easyui-textbox" data-options="required:true"/>
                </td>
            </tr>


            <tr>
                <td>授权信息:</td>
                <td>
                    <input name="license" type="text" class="easyui-textbox" data-options="required:true"/>
                </td>
            </tr>


            <tr>
                <td>是否公开:</td>
                <td>
                    <input name="visibility" class="easyui-combobox"
                           data-options="valueField:'id',textField:'name',url:'admin/getDictionary?type=VISIBILITY'"/>
                </td>
            </tr>


            <tr>
                <td>当前版本:</td>
                <td>
                    <input name="version" type="text" class="easyui-textbox" data-options="required:true"/>
                </td>
            </tr>


            <tr>
                <td>唯一标识:</td>
                <td>
                    <input name="GUID" type="text" class="easyui-textbox" data-options="required:true"/>
                </td>
            </tr>

            <tr>
                <td>数据集:</td>
                <td>
                    <input name="dataset" class="easyui-combobox"
                           data-options="valueField:'id',textField:'name',url:'admin/getDictionary?type=VISIBILITY'"/>
                </td>
            </tr>

            <tr>
                <td>机构:</td>
                <td>
                    <input name="dataset" class="easyui-combobox"
                           data-options="valueField:'id',textField:'name',url:'admin/getOrgs?type=VISIBILITY'"/>
                </td>
            </tr>

            <tr>
                <td>简介:</td>
                <td><input name="description" class="easyui-textbox" data-options="multiline:true"
                           style="height: 100px"></td>
            </tr>
        </table>


    </form>

    <div style="text-align:center;padding:18px;">
        <a href="javascript:void(0);" class="easyui-linkbutton" onclick="_data.createSubmit(this)">保 存</a>
        <a href="javascript:void(0);" class="easyui-linkbutton" onclick="util.formClear(this);">清 空</a>
    </div>
</div>


<script>
    $(function () {
        $('tr').each(function () {
            $(this).find("td:first").css('text-align', 'right');
            $(this).css('line-height', '30px');
        });
    });
</script>
